﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Contents_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Login1_LoggedIn(object sender, EventArgs e)
    {
        setVociMenu();

    }//fM

    private void setVociMenu()
    {
        var utente = this.Page.User;
        if (utente.Identity.IsAuthenticated)
        {
            //Response.Write("Autenticato ");  
            if (utente.IsInRole(Enum.GetName(typeof(RuoliEnum), RuoliEnum.Admin)))
            {
                //Response.Write(" in Admin "); 
                var menu = this.Master.myMenu;// .FindControl("Menu1");
                if (menu == null) return;
                var tot = menu.Items.Count;
                if (menu.Items[tot - 1].Text != "Adm")
                    menu.Items.Add(new MenuItem("Adm", "Adm", string.Empty, "~/Adm/"));
            }

        }
    }




}//fC
